doctype html
html.no-focus lang="en"
  head
    meta charset='utf-8'
    meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
    meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"
    meta name="renderer" content="webkit"
    meta http-equiv="cleartype" content="on"
    meta name="HandheldFriendly" content="True"
    meta name="MobileOptimized" content="320"
    - if content_for?(:title)
      = yield(:title)
    - else
      title CRM-System
    = csrf_meta_tags
    = action_cable_meta_tag
    = content_for?(:head) ? yield(:head) : ''
    = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload'
    = javascript_include_tag 'application', 'data-turbolinks-track': 'reload'
    - if @need_calendar
      = javascript_include_tag 'calendar', 'data-turbolinks-track': 'reload'
    - if @need_vue
      = javascript_include_tag 'vue', 'data-turbolinks-track': 'reload'
    = favicon_link_tag "favicon.ico"
    /! Icons
    /! The following icons can be replaced with your own, they are used by desktop and mobile browsers
    /link href="assets/img/favicons/favicon.png" rel=("shortcut icon") /
    /link href="assets/img/favicons/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png" /
    /link href="assets/img/favicons/favicon-32x32.png" rel="icon" sizes="32x32" type="image/png" /
    /link href="assets/img/favicons/favicon-96x96.png" rel="icon" sizes="96x96" type="image/png" /
    /link href="assets/img/favicons/favicon-160x160.png" rel="icon" sizes="160x160" type="image/png" /
    /link href="assets/img/favicons/favicon-192x192.png" rel="icon" sizes="192x192" type="image/png" /
    /link href="assets/img/favicons/apple-touch-icon-57x57.png" rel="apple-touch-icon" sizes="57x57" /
    /link href="assets/img/favicons/apple-touch-icon-60x60.png" rel="apple-touch-icon" sizes="60x60" /
    /link href="assets/img/favicons/apple-touch-icon-72x72.png" rel="apple-touch-icon" sizes="72x72" /
    /link href="assets/img/favicons/apple-touch-icon-76x76.png" rel="apple-touch-icon" sizes="76x76" /
    /link href="assets/img/favicons/apple-touch-icon-114x114.png" rel="apple-touch-icon" sizes="114x114" /
    /link href="assets/img/favicons/apple-touch-icon-120x120.png" rel="apple-touch-icon" sizes="120x120" /
    /link href="assets/img/favicons/apple-touch-icon-144x144.png" rel="apple-touch-icon" sizes="144x144" /
    /link href="assets/img/favicons/apple-touch-icon-152x152.png" rel="apple-touch-icon" sizes="152x152" /
    /link href="assets/img/favicons/apple-touch-icon-180x180.png" rel="apple-touch-icon" sizes="180x180" /
  body
    #page-container.sidebar-l.sidebar-o.side-scroll.header-navbar-fixed
      nav#sidebar
        #sidebar-scroll
          /! Adding .sidebar-mini-hide to an element will hide it when the sidebar is in mini mode
          .sidebar-content
            /! Side Header
            .side-header.side-content.bg-white-op
              /! Layout API, functionality initialized in App() -> uiLayoutApi()
              button.btn.btn-link.text-gray.pull-right.hidden-md.hidden-lg data-action="sidebar_close" data-toggle="layout" type="button"
                i.fa.fa-times
              /! Themes functionality initialized in App() -> uiHandleTheme()
              a.h5.text-white href="/"
                i.fa.fa-circle-o-notch.text-primary
                span.h5.sidebar-mini-hide CRM-SYSTEM
            /! END Side Header
            /! Side Content
            .side-content
              ul.nav-main
                - @menus.each do |m|
                  li.nav-main-heading
                    span.sidebar-mini-hide= m['name']
                  - m['children'].each do |menu2|
                    li{class="#{'open' if menu2['children'].any?{|x|current_url?(x['url'])}}"}
                      a.nav-submenu data-toggle="nav-submenu" href="#{menu2['url']||'javascript:void(0)'}"
                        - if menu2['icon_class']
                          i class=menu2['icon_class']
                        span.sidebar-mini-hide= menu2['name']
                      ul
                        - menu2['children'].each do |menu3|
                          li
                            = link_to menu3['name'], menu3['url'], class: "#{'active' if current_url?(menu3['url'])}"
      /! Header
      header#header-navbar.content-mini.content-mini-full
        /! Header Navigation Right
        ul.nav-header.pull-right
          li
            .btn-group
              button.btn.btn-default.btn-image.dropdown-toggle data-toggle="dropdown" type="button"
                = image_tag 'avatars/avatar10.jpg'
                span.caret
                - if @unread_message_count>0
                  i.fa.fa-circle.push-5-l[style="color:lightgreen"]
              ul.dropdown-menu.dropdown-menu-right
                li.dropdown-header= current_user
                li.dropdown-header= current_user.customer
                li
                  a href="#{base_notices_path}" tabindex="-1"
                    i.si.si-envelope-open.pull-right
                    span.badge.badge-primary.pull-right= @unread_message_count if @unread_message_count>0
                    | 消息
                /li
                /  a href="base_pages_profile.html" tabindex="-1"
                /    i.si.si-user.pull-right
                /    span.badge.badge-success.pull-right 1
                /    | 个人信息
                li
                  a href="javascript:void(0)" tabindex="-1"
                    i.si.si-settings.pull-right
                    | 设置
                li.divider
                li.dropdown-header 操作
                /li
                /  a href="base_pages_lock.html" tabindex="-1"
                /    i.si.si-lock.pull-right
                /    | Lock Account
                li
                  a href="/logout" data-method='delete' tabindex="-1"
                    i.si.si-logout.pull-right
                    | 安全退出
        /! END Header Navigation Right
        /! Header Navigation Left
        ul.nav-header.pull-left
          li.hidden-md.hidden-lg
            /! Layout API, functionality initialized in App() -> uiLayoutApi()
            button.btn.btn-default data-action="sidebar_toggle" data-toggle="layout" type="button"
              i.fa.fa-navicon
          li.hidden-xs.hidden-sm
            /! Layout API, functionality initialized in App() -> uiLayoutApi()
            button.btn.btn-default data-action="sidebar_mini_toggle" data-toggle="layout" type="button"
              i.fa.fa-ellipsis-v
          li.visible-xs
            /! Toggle class helper (for .js-header-search below), functionality initialized in App() -> uiToggleClass()
            button.btn.btn-default data-class="header-search-xs-visible" data-target=".js-header-search" data-toggle="class-toggle" type="button"
              i.fa.fa-search
          li.js-header-search.header-search
            form.form-horizontal action="base_pages_search.html" method="post"
              .form-material.form-material-primary.input-group.remove-margin-t.remove-margin-b
                input#base-material-text.form-control name="base-material-text" placeholder="Search.." type="text" /
                span.input-group-addon
                  i.si.si-magnifier
      main#main-container
        .content style="padding: 0"
          = yield
      footer#page-footer.content-mini.content-mini-full.font-s12.bg-gray-lighter.clearfix
        span
          |当前系统时间: #{Time.now.label} ，系统响应时间 #{((Time.now-@action_start_time)).round(2)} s.
    /! END Footer
    /! END Page Container
  /#page-loader
  / modal 弹窗
  #application-modal.modal aria-hidden="true" role="dialog" style="display: none;" tabindex="-1"
    .modal-dialog.modal-lg.modal-dialog-popout
      .modal-content
  #application-md-modal.modal aria-hidden="true" role="dialog" style="display: none;" tabindex="-1"
    .modal-dialog.modal-dialog-popout
      .modal-content
javascript:
  show_notice("#{flash[:notice]}")
  error_notice("#{flash[:error]}")